<?php

/**
 * This is the model class for table "image".
 *
 * The followings are the available columns in table 'image':
 * @property string $id
 * @property string $title
 * @property string $desc
 * @property string $image
 * @property string $content
 * @property string $photographer
 * @property string $videographer
 * @property string $markup_artist
 * @property string $dress_designer
 * @property string $director
 * @property string $priority
 * @property string $status
 * @property string $is_delete
 * @property string $create_date
 * @property string $update_date
 */
class Image extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Image the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'image';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('title, desc, image, content, photographer, videographer, markup_artist, dress_designer, director, priority, create_date', 'required'),
			array('title, photographer, videographer, markup_artist, dress_designer, director', 'length', 'max'=>20),
			array('desc', 'length', 'max'=>255),
			array('image', 'length', 'max'=>50),
			array('priority', 'length', 'max'=>11),
			array('status, is_delete', 'length', 'max'=>1),
			array('update_date', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, title, desc, image, content, photographer, videographer, markup_artist, dress_designer, director, priority, status, is_delete, create_date, update_date', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'title' => 'Title',
			'desc' => 'Desc',
			'image' => 'Image',
			'content' => 'Content',
			'photographer' => 'Photographer',
			'videographer' => 'Videographer',
			'markup_artist' => 'Markup Artist',
			'dress_designer' => 'Dress Designer',
			'director' => 'Director',
			'priority' => 'Priority',
			'status' => 'Status',
			'is_delete' => 'Is Delete',
			'create_date' => 'Create Date',
			'update_date' => 'Update Date',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id,true);
		$criteria->compare('title',$this->title,true);
		$criteria->compare('desc',$this->desc,true);
		$criteria->compare('image',$this->image,true);
		$criteria->compare('content',$this->content,true);
		$criteria->compare('photographer',$this->photographer,true);
		$criteria->compare('videographer',$this->videographer,true);
		$criteria->compare('markup_artist',$this->markup_artist,true);
		$criteria->compare('dress_designer',$this->dress_designer,true);
		$criteria->compare('director',$this->director,true);
		$criteria->compare('priority',$this->priority,true);
		$criteria->compare('status',$this->status,true);
		$criteria->compare('is_delete',$this->is_delete,true);
		$criteria->compare('create_date',$this->create_date,true);
		$criteria->compare('update_date',$this->update_date,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}